class: center, middle, inverse, title-slide # ECON 3818 ## Distributions ### Kyle Butts ### 21 July 2021 --- exclude: true --- class: clear, middle <!-- Custom css --> <style type="text/css"> @import url(https://fonts.googleapis.com/css?family=Zilla+Slab:300,300i,400,400i,500,500i,700,700i); /* Create a highlighted class called 'hi' */ .hi { font-weight: 600; } .bw { background-color: rgb(0, 0, 0); color: #ffffff; } .gw { background-color: #d2d2d2; color: #ffffff; } /* Font styling */ .mono { font-family: monospace; } .ul { text-decoration: underline; } .ol { text-decoration: overline; } .st { text-decoration: line-through; } .bf { font-weight: bold; } .it { font-style: italic; } /* Font Sizes */ .bigger { font-size: 125%; } .huge{ font-size: 150%; } .small { font-size: 95%; } .smaller { font-size: 85%; } .smallest { font-size: 75%; } .tiny { font-size: 50%; } /* Remark customization */ .clear .remark-slide-number { display: none; } .inverse .remark-slide-number { display: none; } .remark-code-line-highlighted { background-color: rgba(249, 39, 114, 0.5); } .remark-slide-content { background-color: #ffffff; font-size: 24px; /* font-weight: 300; */ /* line-height: 1.5; */ /* padding: 1em 2em 1em 2em; */ } /* Xaringan tweeks */ .inverse { background-color: #23373B; text-shadow: 0 0 20px #333; /* text-shadow: none; */ } .title-slide { background-color: #ffffff; border-top: 80px solid #ffffff; } .footnote { bottom: 1em; font-size: 80%; color: #7f7f7f; } /* Mono-spaced font, smaller */ .mono-small { font-family: monospace; font-size: 20px; } .mono-small .mjx-chtml { font-size: 103% !important; } .pseudocode, .pseudocode-small { font-family: monospace; background: #f8f8f8; border-radius: 3px; padding: 10px; padding-top: 0px; padding-bottom: 0px; } .pseudocode-small { font-size: 20px; } .super{ vertical-align: super; font-size: 70%; line-height: 1%; } .sub{ vertical-align: sub; font-size: 70%; line-height: 1%; } .remark-code { font-size: 68%; } .inverse > h2 { color: #e64173; font-weight: 300; font-size: 40px; font-style: italic; margin-top: -25px; } .title-slide > h2 { margin-top: -25px; padding-bottom: -20px; color: rgba(249, 38, 114, 0.75); text-shadow: none; font-weight: 300; font-size: 35px; font-style: normal; text-align: left; margin-left: 15px; } .remark-inline-code { background: #F5F5F5; /* lighter */ /* background: #e7e8e2; /* darker */ border-radius: 3px; padding: 4px; } /* 2/3 left; 1/3 right */ .more-left { float: left; width: 63%; } .less-right { float: right; width: 31%; } .more-right ~ * { clear: both; } /* 9/10 left; 1/10 right */ .left90 { padding-top: 0.7em; float: left; width: 85%; } .right10 { padding-top: 0.7em; float: right; width: 9%; } /* 95% left; 5% right */ .left95 { padding-top: 0.7em; float: left; width: 91%; } .right05 { padding-top: 0.7em; float: right; width: 5%; } .left5 { padding-top: 0.7em; margin-left: 0em; margin-right: -0.4em; float: left; width: 7%; } .left10 { padding-top: 0.7em; margin-left: -0.2em; margin-right: -0.5em; float: left; width: 10%; } .left30 { padding-top: 0.7em; float: left; width: 30%; } .right30 { padding-top: 0.7em; float: right; width: 30%; } .thin-left { padding-top: 0.7em; margin-left: -1em; margin-right: -0.5em; float: left; width: 27.5%; } /* Example */ .ex { font-weight: 300; color: #cccccc !important; font-style: italic; } .col-left { float: left; width: 47%; margin-top: -1em; } .col-right { float: right; width: 47%; margin-top: -1em; } .clear-up { clear: both; margin-top: -1em; } /* Format tables */ table { color: #000000; font-size: 14pt; line-height: 100%; border-top: 1px solid #ffffff !important; border-bottom: 1px solid #ffffff !important; } th, td { background-color: #ffffff; } table th { font-weight: 400; } /* Extra left padding */ .pad-left { margin-left: 5%; } /* Extra left padding */ .big-left { margin-left: 15%; margin-bottom: -0.4em; } /* Attention */ .attn { font-weight: 500; color: #e64173 !important; font-family: 'Zilla Slab' !important; } /* Note */ .note { font-weight: 300; font-style: italic; color: #314f4f !important; /* color: #cccccc !important; */ font-family: 'Zilla Slab' !important; } /* Question and answer */ .qa { font-weight: 500; /* color: #314f4f !important; */ color: #e64173 !important; font-family: 'Zilla Slab' !important; } /* Remove orange line */ hr, .title-slide h2::after, .mline h1::after { content: ''; display: block; border: none; background-color: #e5e5e5; color: #e5e5e5; height: 1px; } </style> <!-- From xaringancolor --> <div style = "position:fixed; visibility: hidden"> `\(\require{color}\definecolor{red_pink}{rgb}{0.901960784313726, 0.254901960784314, 0.450980392156863}\)` `\(\require{color}\definecolor{turquoise}{rgb}{0.125490196078431, 0.698039215686274, 0.666666666666667}\)` `\(\require{color}\definecolor{orange}{rgb}{1, 0.647058823529412, 0}\)` `\(\require{color}\definecolor{red}{rgb}{0.984313725490196, 0.380392156862745, 0.0274509803921569}\)` `\(\require{color}\definecolor{blue}{rgb}{0.231372549019608, 0.231372549019608, 0.603921568627451}\)` `\(\require{color}\definecolor{green}{rgb}{0.545098039215686, 0.694117647058824, 0.454901960784314}\)` `\(\require{color}\definecolor{grey_light}{rgb}{0.701960784313725, 0.701960784313725, 0.701960784313725}\)` `\(\require{color}\definecolor{grey_mid}{rgb}{0.498039215686275, 0.498039215686275, 0.498039215686275}\)` `\(\require{color}\definecolor{grey_dark}{rgb}{0.2, 0.2, 0.2}\)` `\(\require{color}\definecolor{purple}{rgb}{0.415686274509804, 0.352941176470588, 0.803921568627451}\)` `\(\require{color}\definecolor{slate}{rgb}{0.192156862745098, 0.309803921568627, 0.309803921568627}\)` </div> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ TeX: { Macros: { red_pink: ["{\color{red_pink}{#1}}", 1], turquoise: ["{\color{turquoise}{#1}}", 1], orange: ["{\color{orange}{#1}}", 1], red: ["{\color{red}{#1}}", 1], blue: ["{\color{blue}{#1}}", 1], green: ["{\color{green}{#1}}", 1], grey_light: ["{\color{grey_light}{#1}}", 1], grey_mid: ["{\color{grey_mid}{#1}}", 1], grey_dark: ["{\color{grey_dark}{#1}}", 1], purple: ["{\color{purple}{#1}}", 1], slate: ["{\color{slate}{#1}}", 1] }, loader: {load: ['[tex]/color']}, tex: {packages: {'[+]': ['color']}} } }); </script> <style> .red_pink {color: #E64173;} .turquoise {color: #20B2AA;} .orange {color: #FFA500;} .red {color: #FB6107;} .blue {color: #3B3B9A;} .green {color: #8BB174;} .grey_light {color: #B3B3B3;} .grey_mid {color: #7F7F7F;} .grey_dark {color: #333333;} .purple {color: #6A5ACD;} .slate {color: #314F4F;} </style> ## Distributions --- # Outline Discrete Case - Probability Mass Function - Calculating probabilities Continuous Case - Probability Density Function - Calculating probabilities --- # Probability Distribution Functions Until now we have discussed probability distributions in very loose terms. We will build a formal definition of a .hi.red_pink[probability distribution function]. First we consider the discrete case, and then the continuous case. --- class: clear,middle ### Discrete --- # Defining Probability Mass Function Let `\(X\)` be a discrete random variable defined over sample space `\(S\)` with outcome `\(x \in S\)`. The .hi.red_pink[probability mass function] (or pmf) of `\(X\)` is a function that assigns a probability value to every possible outcome of `\(X\)`. We write this as `\(P_X(x)\)`, probability of `\(X=x\)`. --- # Example PMF -- Explicitly Given `\(X\)` is defined as the number of people seated at a random table at a restaurant. The PMF of X is provided below:
Probability Distribution of X
x
P(X = x)
1
0.07
2
0.36
3
0.32
4
0.21
5 or more
0.04
--- # Example PMF -- Based on Scenario Suppose you flip a fair coin twice. Let `\(X\)` be the number of heads that appear. The pmf of `\(X\)` is
Probability Distribution of X
x
P_X(x)
0
0.25
1
0.50
2
0.25
--- # Example PMF <img src="data:image/png;base64,#distributions_files/figure-html/unnamed-chunk-2-1.svg" width="90%" style="display: block; margin: auto;" /> --- # Properties of PMFs We say a `\(p_X(x)\)` is a .hi.purple[valid] pmf if it satisfies the following: 1. `\(0 \leq p_X(x) \leq 1\)` for all `\(x \in S\)`. 2. `\(\displaystyle\sum_{x \in S} p_X(x) = 1.\)` --- # Using PMFs We can use the PMF to answer questions about cumulative probabilities, for example: Recall the previous example:
Probability Distribution of X
x
P(X = x)
1
0.07
2
0.36
3
0.32
4
0.21
5 or more
0.04
What is the probability a random table at the restaurant has 2 or 3 people seated? $$ P(X=2) = 0.36 \text{ and } P(X=3) = 0.32 \implies $$ $$ P(X=2 \text{ or } 3) = 0.36 + 0.32 = .68 $$ --- # Clicker Question Assume there are four outcomes of `\(X\)`: `\(1, 5, 10\)` and `\(20\)`. Given the following PMF, what is the probability X=20?
Probability Distribution of X
x
P(X = x)
1
0.42
5
0.23
10
0.18
20
?
<ol type = "a"> <li>0.35</li> <li>0.17</li> <li>0.40</li> <li>Cannot be determined given the information</li> </ol> --- class: clear,middle ### Continuous --- # Defining Probability Density Function Let `\(Y\)` be a continuous random variable defined over the interval `\([a,b]\)`. The .hi.purple[probability density function] (or pdf) of `\(Y\)` is a function, `\(f_Y(y)\)`, that assigns a probability value to every possible .it[interval] in `\([a,b]\)`. We write $$ Pr(c\leqslant Y\leqslant d) = \int_{c}^{d}f_Y(y) dy, $$ for all `\((c,d)\subset [a,b]\)`. --- # Example pdf For `\(Z \sim N(0,1)\)`, find `\(P(Z <= -1)\)`. <img src="data:image/png;base64,#distributions_files/figure-html/unnamed-chunk-4-1.svg" width="80%" style="display: block; margin: auto;" /> --- # Integral of PDF = Probability <img src="data:image/png;base64,#distributions_files/figure-html/unnamed-chunk-5-1.svg" width="100%" style="display: block; margin: auto;" /> --- # Example PDF Suppose that `\(Y\)` is a continuous random variable with pdf `\(f_Y(y) = 3y^2\)` for `\(0<y<1\)`. What is `\(P(\frac{1}{4} \leqslant Y \leqslant \frac{1}{2})\)`? <img src="data:image/png;base64,#distributions_files/figure-html/unnamed-chunk-6-1.svg" width="90%" style="display: block; margin: auto;" /> --- # Example PDF Suppose that `\(Y\)` is a continuous random variable with pdf `\(f_Y(y) = 3y^2\)` for `\(0<y<1\)`. What is `\(P(\frac{1}{4} \leqslant Y \leqslant \frac{1}{2})\)`? --- # Properties of PDFs We say a `\(f_Y(y)\)` is a .hi.purple[valid] pdf if it satisfies the following: 1. `\(0\leqslant \int f_Y(y) \leqslant 1\)` for all `\(y \in [a,b]\)`. 2. `\(\displaystyle\int_{a}^b f_Y(y)dy = 1.\)` Note that `\(Pr(Y=a) = \displaystyle\int_{a}^a f_Y(y)dy = 0\)`. At first this might seem counterintuitive. But imagine trying to stop a stopwatch at exactly 30 seconds. What is the probability of that event? --- # Clicker Question Given the pdf, `\(f(y)=3y^2\)` for `\(0<y<1\)`. What is the `\(P(Y<1/3)\)`? <ol type = "a"> <li>\(\frac{1}{3}\)</li> <li>\(\frac{1}{9}\)</li> <li>\(\frac{1}{27}\)</li> <li>\(\frac{26}{27}\)</li> </ol> --- # Midterm Example Consider the probability distribution for random variable Y: $$ f(y)= 8y, \ 0 \leq y \leq \frac{1}{2} $$ 1. Find `\(P(Y<\frac{1}{3})\)` 2. Find `\(P(Y=\frac{1}{4})\)` 3. Find `\(P(\frac{3}{4}<Y<1)\)`